package it.antonio.ilpizze.mock.verification;

import it.antonio.ilpizze.aop.Invocation;
import it.antonio.ilpizze.mock.ArgumentMatcher;
import it.antonio.ilpizze.mock.Verification;
import it.antonio.ilpizze.reflection.MethodAccessor;

import java.util.List;

public class NeverVerification implements Verification {
	
	@Override
	public String verify(MethodAccessor current, List<ArgumentMatcher> matchers, List<Invocation> allInvocation) {
		for(Invocation invocation: allInvocation){
			
			if(current.equals(invocation.getMethod())){
				
				if(invocation.getArguments().length == 0){
					return errore();
				} else {
					for(int i = 0; i < matchers.size(); i++){
						if(matchers.get(i).matches(invocation.getArguments()[i])){
							return errore();
						}
					}	
				}
			}
			
		}
		
		return null;
	}
	
	private String errore(){
		return"Expected never";
	}
}
